package cn.njxzc.exercises;

/**
 * *
 * 
 * @version : v1.00
 * @Program Name : JavaProgram.exercises.Pro2_1.java
 * @Written by : Roy Xu
 * @Creation Date : 2016年3月9日 下午12:19:17
 * @Description : p74编程题2-1, max min average sum
 * @ModificationHistory Who When What -------- ----------
 *                      ------------------------------------------------ Roy Xu
 *                      2016年3月9日下午12:19:17 TODO *
 */

public class Pro2_2 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int[] a = { 23, 76, 45, 21, 63, 90, 46, 83 };
		int max, min, sum = 0;
		double average = 0.0;
		max = min = a[0];
		for (int i = 0; i < a.length; i++) {
			if (max < a[i])
				max = a[i];
			if (min > a[i])
				min = a[i];
			sum += a[i];
		}
		average = sum / a.length;
		System.out.println("max=" + max + ",min=" + min + ",average=" + average
				+ ",sum=" + sum);

	}

}
